package cn.fivestars.springcloud.order.controller;

import cn.fivestars.springcloud.commons.entities.CommonResult;
import cn.fivestars.springcloud.commons.entities.Payment;
import cn.fivestars.springcloud.order.service.PaymentFeignService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author liangchenzhou1024@163.com
 * @date 2021/2/5
 */
@RestController
@RequestMapping("/order")
public class OrderFeignController {

    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping("/{id}")
    public CommonResult<Payment> getById(@PathVariable("id") Long id) {
        return paymentFeignService.getById(id);
    }

    @GetMapping("/timeout")
    public CommonResult<String> timeOut() {
        // openFeign 默认等待1s
        return paymentFeignService.timeOut();
    }

}
